﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using nanoCMS.Blog.Concrete;
using nanoCMS.Blog.Providers;
using nanoCMS.Core;
using nanoCMS.Core.Test;

namespace nanoCMS.Blog.Test
{
    [TestClass]
    public class BlogCategoryProvider_Test
    {
        [TestMethod]
        public void Add_Category_With_Rights()
        {
            HttpContext.Current = Helpers.FakeHttpContext("12");
            WorldContext wContext = new WorldContext();
            BlogCategoryProvider blogCategoryProvider = new BlogCategoryProvider(wContext);
            BlogCategory blogCategory;
            Assert.AreEqual(blogCategoryProvider.Add("test", "test", out blogCategory, 1), BlogReturn.Success);
        }

        [TestMethod]
        public void Fail_Add_Category_Without_Rights()
        {
            //12 is UserID of user in db
            //TODO: remove magic numbers
            HttpContext.Current = Helpers.FakeHttpContext("12");
            WorldContext wContext = new WorldContext();
          
            BlogCategoryProvider blogCategoryProvider = new BlogCategoryProvider(wContext);
            BlogCategory blogCategory;
            Assert.AreEqual(blogCategoryProvider.Add("test", "test", out blogCategory, 2), BlogReturn.InsufficientRights);
        }
    }
}
